package com.honghu.villagepost.entity.dao;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;

import java.util.List;
import org.greenrobot.greendao.DaoException;
import com.homghu.villagepost.DaoSession;
import com.homghu.villagepost.GoodsEntityDao;
import com.homghu.villagepost.StoreEntityDao;

/**
 * 作者: liyu on  2017/11/18 0018 13:55
 * 功能描述: 店铺信息
 * 备注:
 */
@Entity(nameInDb = "store")
public class StoreEntity implements Parcelable {

    @Id
    private long id;//店铺id

    private int shopType;//店铺类型

    private String name;//店铺名称

    private String intro;//简介

    private String principalName;//负责人姓名

    private String principalMobile;//负责人联系方式

    private String province;//店铺所在省份

    private String city;//店铺所在城市

    private String district;//店铺所在区

    private String address;//店铺所在详细地址

    private String adcode;//行政区代码

    private String logo;//店铺图片logo

    private long updateTime;//更新时间，排序用到

    @Transient
    private List<GoodsEntity> goodsList;//商品列表

    @Transient
    private boolean isSelect;

    public StoreEntity() {
    }


    protected StoreEntity(Parcel in) {
        id = in.readLong();
        shopType = in.readInt();
        name = in.readString();
        intro = in.readString();
        principalName = in.readString();
        principalMobile = in.readString();
        province = in.readString();
        city = in.readString();
        district = in.readString();
        address = in.readString();
        adcode = in.readString();
        logo = in.readString();
        updateTime = in.readLong();
        goodsList = in.createTypedArrayList(GoodsEntity.CREATOR);
        isSelect = in.readByte() != 0;
    }


    @Generated(hash = 2021388776)
    public StoreEntity(long id, int shopType, String name, String intro,
            String principalName, String principalMobile, String province,
            String city, String district, String address, String adcode,
            String logo, long updateTime) {
        this.id = id;
        this.shopType = shopType;
        this.name = name;
        this.intro = intro;
        this.principalName = principalName;
        this.principalMobile = principalMobile;
        this.province = province;
        this.city = city;
        this.district = district;
        this.address = address;
        this.adcode = adcode;
        this.logo = logo;
        this.updateTime = updateTime;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeInt(shopType);
        dest.writeString(name);
        dest.writeString(intro);
        dest.writeString(principalName);
        dest.writeString(principalMobile);
        dest.writeString(province);
        dest.writeString(city);
        dest.writeString(district);
        dest.writeString(address);
        dest.writeString(adcode);
        dest.writeString(logo);
        dest.writeLong(updateTime);
        dest.writeTypedList(goodsList);
        dest.writeByte((byte) (isSelect ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<StoreEntity> CREATOR = new Creator<StoreEntity>() {
        @Override
        public StoreEntity createFromParcel(Parcel in) {
            return new StoreEntity(in);
        }

        @Override
        public StoreEntity[] newArray(int size) {
            return new StoreEntity[size];
        }
    };

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getShopType() {
        return this.shopType;
    }

    public void setShopType(int shopType) {
        this.shopType = shopType;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIntro() {
        return this.intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getPrincipalName() {
        return this.principalName;
    }

    public void setPrincipalName(String principalName) {
        this.principalName = principalName;
    }

    public String getPrincipalMobile() {
        return this.principalMobile;
    }

    public void setPrincipalMobile(String principalMobile) {
        this.principalMobile = principalMobile;
    }

    public String getProvince() {
        return this.province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return this.city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return this.district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getAdcode() {
        return this.adcode;
    }

    public void setAdcode(String adcode) {
        this.adcode = adcode;
    }

    public String getLogo() {
        return this.logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    public List<GoodsEntity> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<GoodsEntity> goodsList) {
        this.goodsList = goodsList;
    }
}
